using System;
using Castle.ActiveRecord;
using Castle.Components.Validator;

namespace WineCellar.Data
{
	[ActiveRecord("Region", Schema = "dbo", Lazy = false, UseAutoImport = false)]
    public partial class Region
    {

        private string name;
        private Nullable<DateTime> dateAdded;
        private Nullable<int> id;        
        private User addedBy;

        [Property("Name", ColumnType = "String", NotNull = true)]
		[ValidateNonEmpty("Name is a required field")]
        public virtual string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }

        [Property("DateAdded", ColumnType = "Timestamp")]
        public virtual Nullable<DateTime> DateAdded
        {
            get
            {
                return this.dateAdded;
            }
            set
            {
                this.dateAdded = value;
            }
        }

        [PrimaryKey(PrimaryKeyType.Identity)]
        public virtual Nullable<int> Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        [BelongsTo("UserAdded", NotNull = true)]
        public virtual User AddedBy
        {
            get
            {
                return this.addedBy;
            }
            set
            {
                this.addedBy = value;
            }
        }

        public override string ToString()
        {
            return Name;
        }
    }  
}
